// 抽象类 一组行为契约

#include <iostream>
using namespace std;

// 抽象类
// 若全部都是纯虚函数，它就是 interface 接口
class Lover
{
private:

public:
    Lover() {}
    ~Lover() {}
    // 纯虚函数
    virtual void kiss() = 0;
};

class Dog
:public Lover
{
private:

public:
    Dog() {}
    ~Dog() {}
    void kiss() override {
        cout << "Dog kiss" << endl;
    }
};

class Girl
:public Lover
{
private:

public:
    Girl() {
        cout << "Girl()" << endl;
    }
    ~Girl() {
        cout << "~Girl()" << endl;
    }
    void kiss() override {
        cout << "girl kiss " << endl;
    }
};

class Boy
{
private:
    // 依赖于一个抽象的定义，非为具体实现
    // 拓展
    Lover *_lover;
public:
    Boy() {
        cout << "Boy()" << endl;
    }
    ~Boy() {
        cout << "~Boy()" << endl;
    }
    // 
    void setLover(Lover* lover) {
        _lover = lover;
    }
    // 
    void marry() {
        cout << "boy marry" << endl;
        _lover->kiss();
    }
};


int main(int argc, char const *argv[])
{
    Girl g1;
    Boy b1;
    Dog d1;
    b1.setLover(&d1);
    b1.marry();

    return 0;
}
